<? // pull - pull data - either null, list, or data

$ud_id = @pure_integer($_GET['ud_id']);
$url = @pure_url($_GET['url']);
$title = @pure_string($_GET['title']);
$usr_id = $_SESSION['usr_id'];

// if ud_id, then single record
if( $ud_id ) {
	$query = "select * from user_data where usr_id=$usr_id and ud_id=$ud_id";
	//-echo "single: $query<br/>";
	$rcd = db_get_rcd( $query );
	ajax_exit( 'success', 'record from server', array( 'row'=>$rcd ) );
}

// list of possible records
else {
	$query = "select ud_id, url, title, access_ts, 'server' as source from user_data where usr_id=$usr_id "
			.(($url)?"and url='$url' ":'')
			.(($title)?"and title='$title' ":'')
		." order by access_ts desc";
	//-echo "list: $query<br/>";
	$arr = db_get_rcds( $query );
	ajax_exit( 'success', 'records from server', array( 'rows'=>$arr ) );
}



?>
